Choose Application
The Choose Application command allows the user to choose a running application from a dialog box like the one shown in Figure 2-1.Figure 2-1 A Choose Application dialog box
The dialog box displays applications on the current computer and on any computer connected to the same network.
Choose Application is the only command provided by the Choose Application scripting addition.
SYNTAX
choose application [ with prompt promptString ] ÿ [ application label appListLabel ]PARAMETERS
- promptString
- The prompt to be displayed in the dialog box. The prompt can be up to 255 characters long, but the standard dialog box has room for only about 50 characters. If you omit the
with prompt
parameter, the string"Choose a program to link to:"
is displayed.
Class: String
Default Value:"Choose a program to link to:"
- appListLabel
- The label above the list of applications displayed in the dialog box. The label can be up to 255 characters long, but the standard dialog box has room for only about 25 characters. If you omit the
application label
parameter, the string"Programs"
is displayed.
Class: String
Default Value:"Programs"
RESULT
A reference to the application specified by the user.EXAMPLES
choose application with prompt "Choose a spelling checker:"tell (choose application with prompt ÿ "Choose a scriptable text editor:") --other statements end tellNOTES
If the user chooses the Cancel button, Display Dialog returns error -128. If you want your script to continue after the user clicks Cancel, you must include an error handler. For information about Tell statements and error handlers, see Chapter 8, "Handlers," of the AppleScript Language Guide.ERRORS
Error
numberError message -108 Out of memory. -128 User canceled.